﻿using KWT.DRG_DIP.Common;
using KWT.DRG_DIP.DO.System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KWT.DRG_DIP.DTO.Settlement.List
{
    public class InAddOrUpdate
    {
        /// <summary>
        /// 清单头部
        /// </summary>
        public Head Head { get; set; }
        /// <summary>
        /// 基本信息
        /// </summary>
        public BasicInfo BasicInfo { get; set; }
        /// <summary>
        /// 慢特病诊疗信息
        /// </summary>
        public List<SpecialDiagInfo> SpecialDiagInfos { get; set; }
        /// <summary>
        /// 住院诊疗信息
        /// </summary>
        public DiagInfo DiagInfo { get; set; }
        /// <summary>
        /// 相关医疗人员信息
        /// </summary>
        public PersonInfo PersonInfo { get; set; }
        /// <summary>
        /// 医疗收费信息
        /// </summary>
        public ChargeInfo ChargeInfo { get; set; }
        /// <summary>
        /// 质控信息
        /// </summary>
        public List<QCInfo> QCInfos { get; set; }
        /// <summary>
        /// 额外扩展信息
        /// </summary>
        public Extra Extra { get; set; }
    }

    public class Extra
    {
        /// <summary>
        /// 异常行为
        /// </summary>
        public string Abnormal { get; set; }
        /// <summary>
        /// 科室ID
        /// </summary>
        public string CategoryID { get; set; }
        /// <summary>
        /// 科室名称
        /// </summary>
        public string CategoryName { get; set; }
        /// <summary>
        /// 分组编码
        /// </summary>
        public string Group_Code { get; set; }
        /// <summary>
        /// 分组名称
        /// </summary>
        public string Group_Name { get; set; }
        /// <summary>
        /// DIP辅助目录类别
        /// </summary>
        public string Assist_Type { get; set; }
        /// <summary>
        /// DIP辅助目录名称
        /// </summary>
        public string Assist_Name { get; set; }
        /// <summary>
        /// DIP辅助目录编码
        /// </summary>
        public string Assist_Code { get; set; }
    }

    /// <summary>
    /// 清单头部
    /// </summary>
    public class Head
    {
        /// <summary>
        /// 清单主键
        /// </summary>
        public string ListID { get; set; }
        /// <summary>
        /// 定点医疗机构名称
        /// </summary>
        public string HospitalName { get; set; }
        /// <summary>
        /// 定点医疗机构代码
        /// </summary>
        public string HospitalCode { get; set; }
        /// <summary>
        /// 医保结算等级
        /// </summary>
        public string Level { get; set; }
        /// <summary>
        /// 医保编号
        /// </summary>
        public string InsureCode { get; set; }
        /// <summary>
        /// 病案号
        /// </summary>
        public string Number { get; set; }
        /// <summary>
        /// 健康卡号
        /// </summary>
        public string CardNo { get; set; }
        /// <summary>
        /// 申报时间
        /// </summary>
        public DateTime DeclareTime { get; set; } = DateTime.Now;
    }

    /// <summary>
    /// 基本信息
    /// </summary>
    public class BasicInfo
    {
        /// <summary>
        /// 清单ID
        /// </summary>
        public string ListID { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string RealName { get; set; }
        /// <summary>
        /// 姓名拼音首字母
        /// </summary>
        public string PinYin
        {
            get { return _Tool.ToPinYin(RealName); }
            set { }
        }
        /// <summary>
        /// 性别
        /// </summary>
        public int Sex { get; set; }
        /// <summary>
        /// 出生年
        /// </summary>
        public int Year { get; set; }
        /// <summary>
        /// 出生月
        /// </summary>
        public int Month { get; set; }
        /// <summary>
        /// 出生日
        /// </summary>
        public int Day { get; set; }
        /// <summary>
        /// 出生地
        /// </summary>
        public string BornAddr { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        public int Age { get; set; }
        /// <summary>
        /// （年龄不足1周岁） 年龄
        /// </summary>
        public int Age_New { get; set; }
        /// <summary>
        /// 国家
        /// </summary>
        public string Coutry { get; set; }
        /// <summary>
        /// 民族
        /// </summary>
        public string Nation { get; set; }
        /// <summary>
        /// 籍贯
        /// </summary>
        public string Origin { get; set; }
        /// <summary>
        /// 患者证件类别
        /// </summary>
        public string CertType { get; set; }
        /// <summary>
        /// 患者证件号码
        /// </summary>
        public string CertNo { get; set; }
        /// <summary>
        /// 婚姻
        /// </summary>
        public string Marriage { get; set; }
        /// <summary>
        /// 邮编
        /// </summary>
        public string PostCode { get; set; }
        /// <summary>
        /// 户口地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 职业
        /// </summary>
        public string JobType { get; set; }
        /// <summary>
        /// 现住址
        /// </summary>
        public string HomeAddress { get; set; }
        /// <summary>
        /// 现住址邮编
        /// </summary>
        public string HomePostCode { get; set; }
        /// <summary>
        /// 工作单位名称
        /// </summary>
        public string JobName { get; set; }
        /// <summary>
        /// 工作单位地址
        /// </summary>
        public string JobAddress { get; set; }
        /// <summary>
        /// 单位电话
        /// </summary>
        public string JobPhone { get; set; }
        /// <summary>
        /// 单位邮政编码
        /// </summary>
        public string JobPostCode { get; set; }
        /// <summary>
        /// 联系人姓名
        /// </summary>
        public string ContactName { get; set; }
        /// <summary>
        /// 与联系人的关系
        /// </summary>
        public int ContactType { get; set; }
        /// <summary>
        /// 联系人地址
        /// </summary>
        public string ContactAddress { get; set; }
        /// <summary>
        /// 联系人电话
        /// </summary>
        public string ContactPhone { get; set; }
        /// <summary>
        /// 医保类型
        /// </summary>
        public int InsureType { get; set; }
        /// <summary>
        /// 特殊人员类型
        /// </summary>
        public int SpecialType { get; set; }
        /// <summary>
        /// 参保地名称
        /// </summary>
        public string JoinArea { get; set; }
        /// <summary>
        /// 参保地编码
        /// </summary>
        public string JoinCode { get; set; }
        /// <summary>
        /// 新生儿入院类型
        /// </summary>
        public int NewBornInType { get; set; }
        /// <summary>
        /// 新生儿出院体重
        /// </summary>
        public int NewBornOutWeight { get; set; }
        /// <summary>
        /// 新生儿入院体重
        /// </summary>
        public int NewBornInWeight { get; set; }
    }

    /// <summary>
    /// 慢特病诊疗信息
    /// </summary>
    public class SpecialDiagInfo
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string SDID { get; set; }
        /// <summary>
        /// 清单主键
        /// </summary>
        public string ListID { get; set; }
        public string DiagType { get; set; }
        /// <summary>
        /// 就诊日期
        /// </summary>
        public DateTime DiagTime { get; set; }
        /// <summary>
        /// 病种名称
        /// </summary>
        public string DiseaseName { get; set; }
        /// <summary>
        /// 病种代码
        /// </summary>
        public string DiseaseCode { get; set; }
        /// <summary>
        /// 手术及操作名称
        /// </summary>
        public string OperName { get; set; }
        /// <summary>
        /// 手术及操作代码
        /// </summary>
        public string OperCode { get; set; }
    }

    /// <summary>
    /// 住院诊疗信息
    /// </summary>
    public class DiagInfo
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string DIID { get; set; }
        public string ListID { get; set; }
        /// <summary>
        /// 住院医疗类型
        /// </summary>
        public int MedicalType { get; set; }
        /// <summary>
        /// 入院途径
        /// </summary>
        /// 
        public int Way { get; set; }
        /// <summary>
        /// 治疗类型
        /// </summary>
        public string HealType { get; set; }
        /// <summary>
        /// 入院时间
        /// </summary>
        public DateTime InTime { get; set; }
        /// <summary>
        /// 住院次数
        /// </summary>
        public int InCount { get; set; }
        /// <summary>
        /// 入院科别
        /// </summary>
        public string InCategory { get; set; }
        /// <summary>
        /// 转科科别
        /// </summary>
        public string TurnCategory { get; set; }
        /// <summary>
        /// 入院病房
        /// </summary>
        public string InRoom { get; set; }
        /// <summary>
        /// 出院病房
        /// </summary>
        public string OutRoom { get; set; }
        /// <summary>
        /// 出院时间
        /// </summary>
        public DateTime OutTime { get; set; }
        /// <summary>
        /// 出院科别
        /// </summary>
        public string OutCategory { get; set; }
        /// <summary>
        /// 实际住院（天）
        /// </summary>
        public int InDays { get; set; }
        /// <summary>
        /// 门诊诊断（西医）
        /// </summary>
        public string In_WM_Diag { get; set; }
        /// <summary>
        /// 疾病代码（西医）
        /// </summary>
        public string In_WM_Code { get; set; }
        /// <summary>
        /// 门诊诊断（中医）
        /// </summary>
        public string In_TCM_Diag { get; set; }
        /// <summary>
        /// 疾病代码（中医）
        /// </summary>
        public string In_TCM_Code { get; set; }
        /// <summary>
        /// 损伤，中毒的外部原因
        /// </summary>
        public string Poison { get; set; }
        /// <summary>
        /// 损伤，中毒的疾病编码
        /// </summary>
        public string PoisonCode { get; set; }
        /// <summary>
        /// 病理诊断
        /// </summary>

        public string Pathology { get; set; }
        /// <summary>
        /// 病理病种编码
        /// </summary>
        public string PathologyCode { get; set; }
        /// <summary>
        /// 病理号
        /// </summary>
        public string PathologyNo { get; set; }
        /// <summary>
        /// 药物过敏(1:无 2：有)
        /// </summary>
        public string React { get; set; }
        /// <summary>
        /// 过敏药物
        /// </summary>
        public string ReactName { get; set; }
        /// <summary>
        /// 死亡患者尸检（1：是 2：否）
        /// </summary>
        public string DeathCheck { get; set; }
        /// <summary>
        /// 血型
        /// </summary>
        public string BloodType { get; set; }
        /// <summary>
        /// Rh
        /// </summary>
        public string Rh { get; set; }

        /// <summary>
        /// 呼吸机使用天数
        /// </summary>
        public int UseDay { get; set; }
        /// <summary>
        /// 呼吸机使用小时数
        /// </summary>
        public int UseHour { get; set; }
        /// <summary>
        /// 呼吸机使用分钟数
        /// </summary>
        public int UseMinute { get; set; }
        /// <summary>
        /// 昏迷天数1
        /// </summary>
        public int StunDay1 { get; set; }
        /// <summary>
        /// 昏迷小时数1
        /// </summary>
        public int StunHour1 { get; set; }
        /// <summary>
        /// 昏迷分钟数1
        /// </summary>
        public int StunMinute1 { get; set; }
        /// <summary>
        /// 昏迷天数2
        /// </summary>
        public int StunDay2 { get; set; }
        /// <summary>
        /// 昏迷小时数2
        /// </summary>
        public int StunHour2 { get; set; }
        /// <summary>
        /// 昏迷分钟数2
        /// </summary>
        public int StunMinute2 { get; set; }
        /// <summary>
        /// 特级护理天数
        /// </summary>
        public int Care0 { get; set; }
        /// <summary>
        /// 一级护理天数
        /// </summary>
        public int Care1 { get; set; }
        /// <summary>
        /// 二级护理天数
        /// </summary>
        public int Care2 { get; set; }
        /// <summary>
        /// 三级护理天数
        /// </summary>
        public int Care3 { get; set; }
        /// <summary>
        /// 离院方式
        /// </summary>
        public int OutWay { get; set; }
        /// <summary>
        /// 离院方式(机构名称)
        /// </summary>
        public string OutWay_Dept { get; set; }
        /// <summary>
        /// 是否有出院31天内再住院计划
        /// </summary>
        public int OutAgainType { get; set; }
        /// <summary>
        /// 是否有出院31天内再住院计划（目的）
        /// </summary>
        public string OutAgainType_Memo { get; set; }
        /// <summary>
        /// 病案质量
        /// </summary>
        public string BAZL { get; set; }
        /// <summary>
        /// 质控日期
        /// </summary>
        public DateTime ZKRQ { get; set; }
        /// <summary>
        /// 重症监护信息列表
        /// </summary>
        public string ICU_Json { get; set; }
        /// <summary>
        /// 输血信息列表
        /// </summary>
        public string Blood_Json { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：天
        /// </summary>
        public int RYQ_T { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：小时
        /// </summary>
        public int RYQ_XS { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：分钟
        /// </summary>
        public int RYQ_FZ { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：天
        /// </summary>
        public int RYH_T { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：小时
        /// </summary>
        public int RYH_XS { get; set; }
        /// <summary>
        /// 颅脑损伤患者昏迷入院前时间：分钟
        /// </summary>
        public int RYH_FZ { get; set; }
        public List<DiagInfoItem> DiagItems { get; set; }
        public List<DiagInfoOperItem> OperItems { get; set; }
    }
    /// <summary>
    /// 诊疗明细
    /// </summary>
    public class DiagInfoItem
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string DIID { get; set; }
        /// <summary>
        /// 清单ID
        /// </summary>
        public string ListID { get; set; }
        /// <summary>
        /// 1：主要 2：其他
        /// </summary>
        public int Type { get; set; }
        /// <summary>
        /// 1：西医 2：中医
        /// </summary>
        public int Way { get; set; }
        /// <summary>
        /// 病种代码
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 病种名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 入院病情
        /// </summary>
        public string Desc { get; set; }
    }
    /// <summary>
    /// 手术及操作明细
    /// </summary>
    public class DiagInfoOperItem
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string DOID { get; set; }
        /// <summary>
        /// 清单ID
        /// </summary>
        public string ListID { get; set; }
        /// <summary>
        /// 1：主要 0：其他
        /// </summary>
        public int Type { get; set; }
        /// <summary>
        /// 手术及操作名称
        /// </summary>
        public string OperName { get; set; }
        /// <summary>
        /// 手术及操作代码
        /// </summary>
        public string OperCode { get; set; }
        /// <summary>
        /// 麻醉方式
        /// </summary>
        public string Way { get; set; }
        /// <summary>
        /// 医师姓名
        /// </summary>
        public string OperDocName { get; set; }
        /// <summary>
        /// 医师代码
        /// </summary>
        public string OperDocCode { get; set; }
        /// <summary>
        /// 麻醉医师姓名
        /// </summary>
        public string AnesDocName { get; set; }
        /// <summary>
        /// 麻醉医师代码
        /// </summary>
        public string AnesDocCode { get; set; }
        /// <summary>
        /// 手术起始时间
        /// </summary>
        public DateTime OperTime { get; set; }
        /// <summary>
        /// 麻醉起始时间
        /// </summary>
        public DateTime AnesTime { get; set; }
        /// <summary>
        /// 手术级别
        /// </summary>
        public string Level { get; set; }
        /// <summary>
        /// 术者
        /// </summary>
        public string SZ { get; set; }
        /// <summary>
        /// I助
        /// </summary>
        public string YZ { get; set; }
        /// <summary>
        /// II助
        /// </summary>
        public string EZ { get; set; }
        /// <summary>
        /// 切口等级
        /// </summary>
        public string CutLevel { get; set; }
        /// <summary>
        /// 切口愈合类别
        /// </summary>
        public string CutType { get; set; }
    }

    /// <summary>
    /// 收费信息
    /// </summary>
    public class ChargeInfo
    {
        public string ListID { get; set; }
        /// <summary>
        /// 业务流水号
        /// </summary>
        public string ChargeID { get; set; }
        /// <summary>
        /// 票据代码
        /// </summary>
        public string TicketCode { get; set; }
        /// <summary>
        /// 票据号码
        /// </summary>
        public string TicketNo { get; set; }
        /// <summary>
        /// 结算开始时间
        /// </summary>
        public DateTime StartDate { get; set; }
        /// <summary>
        /// 结算结束时间
        /// </summary>
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 总费用
        /// </summary>
        public decimal Total { get; set; }
        /// <summary>
        /// 自付金额
        /// </summary>
        public decimal ZFJE { get; set; }
        /// <summary>
        /// 一般医疗服务费
        /// </summary>
        public decimal YBYLFWF { get; set; }
        /// <summary>
        /// 一般治疗操作费
        /// </summary>
        public decimal YBZLCZF { get; set; }
        /// <summary>
        /// 护理费
        /// </summary>
        public decimal HLF { get; set; }
        /// <summary>
        /// 其他费用
        /// </summary>
        public decimal QTFY { get; set; }
        /// <summary>
        /// 病理诊断费
        /// </summary>
        public decimal BLZDF { get; set; }
        /// <summary>
        /// 实验室诊断费
        /// </summary>
        public decimal SYSZDF { get; set; }
        /// <summary>
        /// 影像学诊断费
        /// </summary>
        public decimal YXXZDF { get; set; }
        /// <summary>
        /// 临床诊断项目费
        /// </summary>
        public decimal LCZDXMF { get; set; }
        /// <summary>
        /// 非手术治疗项目费
        /// </summary>
        public decimal FSSZLXMF { get; set; }
        /// <summary>
        /// 临床物理治疗费
        /// </summary>
        public decimal LCWLZLF { get; set; }
        /// <summary>
        /// 手术治疗费
        /// </summary>
        public decimal SSZLF { get; set; }
        /// <summary>
        /// 麻醉费
        /// </summary>
        public decimal MZF { get; set; }
        /// <summary>
        /// 手术费
        /// </summary>
        public decimal SSF { get; set; }
        /// <summary>
        /// 康复费
        /// </summary>
        public decimal KFF { get; set; }
        /// <summary>
        /// 中医治疗费
        /// </summary>
        public decimal ZYZLF { get; set; }
        /// <summary>
        /// 西药费
        /// </summary>
        public decimal XYF { get; set; }
        /// <summary>
        /// 抗菌药物费
        /// </summary>
        public decimal KJYWF { get; set; }
        /// <summary>
        /// 中成药费
        /// </summary>
        public decimal ZCYF { get; set; }
        /// <summary>
        /// 中草药费
        /// </summary>
        public decimal ZCYF1 { get; set; }
        /// <summary>
        /// 血费
        /// </summary>
        public decimal XF { get; set; }
        /// <summary>
        /// 白蛋白类制品费
        /// </summary>
        public decimal BDBLZPF { get; set; }
        /// <summary>
        /// 球蛋白类制品费
        /// </summary>
        public decimal QDBLZPF { get; set; }
        /// <summary>
        /// 凝血因子类制品费
        /// </summary>
        public decimal NXYZLZPF { get; set; }
        /// <summary>
        /// 细胞因子类制品费
        /// </summary>
        public decimal XBYZLZPF { get; set; }
        /// <summary>
        /// 检查用一次性医用材料费
        /// </summary>
        public decimal JCCLF { get; set; }
        /// <summary>
        /// 治疗用一次性医用材料费
        /// </summary>
        public decimal ZLCLF { get; set; }
        /// <summary>
        /// 手术用一次性医用材料费
        /// </summary>
        public decimal SSCLF { get; set; }
        /// <summary>
        /// 其他费
        /// </summary>
        public decimal QTF { get; set; }
        /// <summary>
        /// 医保统筹基金支付
        /// </summary>

        public decimal YBTCJJZF { get; set; }
        /// <summary>
        /// 职工大额补助
        /// </summary>
     
        public decimal ZGDEBZ { get; set; }
        /// <summary>
        /// 居民大病保险
        /// </summary>
     
        public decimal JMDBBX { get; set; }
        /// <summary>
        /// 公务员医疗补助
        /// </summary>
     
        public decimal GWYYLBZ { get; set; }
        /// <summary>
        /// 个人自付
        /// </summary>
     
        public decimal GRZF1 { get; set; }
        /// <summary>
        /// 个人自费
        /// </summary>
      
        public decimal GRZF2 { get; set; }
        /// <summary>
        /// 医疗救助支付
        /// </summary>
     
        public decimal YLJZZF { get; set; }
        /// <summary>
        /// 企业补充
        /// </summary>
       
        public decimal QYBC { get; set; }
        /// <summary>
        /// 商业保险
        /// </summary>
   
        public decimal SYBX { get; set; }
        /// <summary>
        /// 个人账户支付
        /// </summary>

        public decimal GRZHZF { get; set; }
        /// <summary>
        /// 个人现金支付
        /// </summary>
      
        public decimal GRXJZF { get; set; }
        /// <summary>
        /// 医保支付方式
        /// </summary>
        public int PayType { get; set; }
        /// <summary>
        /// 定点医疗机构填报部门
        /// </summary>
        public string Section { get; set; }
        /// <summary>
        /// 医保经办机构
        /// </summary>
        public string Dept { get; set; }
        /// <summary>
        /// 定点医疗机构填报人
        /// </summary>
        public string FillPerson { get; set; }
        /// <summary>
        /// 医保机构经办人
        /// </summary>
        public string DoPerson { get; set; }

        public List<ChargeInfoItem> Items { get; set; }
    }
    /// <summary>
    /// 收费明细
    /// </summary>
    public class ChargeInfoItem 
    {
        /// <summary>
        /// 主键
        /// </summary>
        public string CIID { get; set; }
        public string ListID { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string ItemName { get; set; }
        /// <summary>
        /// 金额
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 甲类
        /// </summary>
        public decimal Jia { get; set; }
        /// <summary>
        /// 乙类
        /// </summary>
        public decimal Yi { get; set; }
        /// <summary>
        /// 自费
        /// </summary>
        public decimal Self { get; set; }
        /// <summary>
        /// 其他
        /// </summary>
        public decimal Others { get; set; }

    }

    public class PersonInfo
    {
        public string LPID { get; set; }
        public string ListID { get; set; }
        /// <summary>
        /// 主诊医师姓名
        /// </summary>
        public string DcName { get; set; }
        /// <summary>
        /// 主诊医师代码
        /// </summary>
        public string DcCode { get; set; }
        /// <summary>
        /// 责任护士姓名
        /// </summary>
        public string NurseName { get; set; }
        /// <summary>
        /// 责任护士代码
        /// </summary>
        public string NurseCode { get; set; }
        /// <summary>
        /// 科主任
        /// </summary>
        public string KZR { get; set; }
        /// <summary>
        /// 主任（副主任）医师
        /// </summary>
        public string ZRYS { get; set; }
        /// <summary>
        /// 进修医师
        /// </summary>
        public string JXYS { get; set; }
        /// <summary>
        /// 住院医师
        /// </summary>
        public string ZYYS { get; set; }
        /// <summary>
        /// 实习医师
        /// </summary>
        public string SXYS { get; set; }
        /// <summary>
        /// 编码员
        /// </summary>
        public string BMY { get; set; }
        /// <summary>
        /// 质控医师
        /// </summary>
        public string ZKYS { get; set; }
        /// <summary>
        /// 质控护士
        /// </summary>
        public string ZKHS { get; set; }
    }

    public class QCInfo
    {
        public string QIID { get; set; }
        /// <summary>
        /// 清单ID
        /// </summary>
        public string ListID { get; set; }
        /// <summary>
        /// 错误代码
        /// </summary>
        public string ErrCode { get; set; }
        /// <summary>
        /// 字段名
        /// </summary>
        public string Property { get; set; }

        /// <summary>
        /// 字段名
        /// </summary>
        public string PropertyName { get; set; }
        /// <summary>
        /// 错误信息
        /// </summary>
        public string Msg { get; set; }
    }
}
